<?php


namespace app\controller;

use app\BaseController;
use think\facade\View;

class Login extends BaseController
{
    public function index()
    {
        return View::fetch('login/index');
    }


    public function login()
    {
        $post = app()->request->post();
        $username = $post['username'] ?? '';
        $password = $post['password'] ?? '';

        if($username != 'zhmadmin' || md5($password) != '625f558b7a3f9f6cf3a98cc9d83731ce') {
            View::assign('msg', '帐号密码错误');
            return View::fetch('login/index');
        }

        app()->session->set('isLogin', true);
        return redirect('/index/index');
    }
}